import request from "@/utils/request";

// 查询门诊收费记录主列表 (分页)
export function selectPageOutpFeesMaster(query) {
    return request({
        url: "/business/outpFeesMaster/selectPage",
        method: "get",
        params: query,
    });
}

// 查询门诊收费记录主列表 (不分页)
export function listOutpFeesMaster(query) {
    return request({
        url: "/business/outpFeesMaster/list",
        method: "get",
        params: query,
    });
}

// 查询门诊退费申请记录
export function getRefundList(query) {
    return request({
        url: "/business/outpFeesMaster/getRefundList",
        method: "get",
        params: query,
    });
}

// 门诊退费确认前剩余记录的预结算
export function refundPreSettlement(query) {
    return request({
        url: "/business/outpFeesMaster/refundPreSettlement",
        method: "get",
        params: query,
    });
}

// 查询门诊收费记录主详细
export function getOutpFeesMaster(outpFeesMasterId) {
    return request({
        url: "/business/outpFeesMaster/" + outpFeesMasterId,
        method: "get",
    });
}

// 门诊收费记录作废
export function abolishOutpFeesMaster(feesNo, orgId) {
    return request({
        url: "/business/outpFeesMaster/abolishOutpFeesMaster/" + feesNo + "/" + orgId,
        method: "get",
    });
}

// 获取电子票据pdf-Url
export function getInvoiceIssuePdfUrl(feesNo, orgId) {
    return request({
        url: "/business/outpFeesMaster/getInvoiceIssuePdfUrl/" + feesNo + "/" + orgId,
        method: "get",
    });
}

// 新增门诊收费记录主
export function addOutpFeesMaster(data) {
    return request({
        url: "/business/outpFeesMaster",
        method: "post",
        data: data,
    });
}

// 修改门诊收费记录主
export function updateOutpFeesMaster(data) {
    return request({
        url: "/business/outpFeesMaster",
        method: "put",
        data: data,
    });
}

// 删除门诊收费记录主
export function delOutpFeesMaster(outpFeesMasterId) {
    return request({
        url: "/business/outpFeesMaster/" + outpFeesMasterId,
        method: "delete",
    });
}

// 申请退费
export function refundApplication(id, chargeFlag, type, orgId, feesNo) {
    return request({
        url:
            "/business/outpFeesMaster/refundApplication/" +
            id +
            "/" +
            chargeFlag +
            "/" +
            type +
            "/" +
            orgId +
            "/" +
            feesNo,
        method: "get",
    });
}

// 退费确认
export function confirmationRefund(data) {
    return request({
        url: "/business/outpFeesMaster/confirmationRefund",
        method: "post",
        data: data,
    });
}

export function listClinicOrders(query) {
    return request({
        url: "/business/outpFeesMaster/listClinicOrders",
        method: "get",
        params: query,
    });
}

/*
    按照feesNo、ApplyNo进行分组 ，返回的是类似于申请主信息的list
    按照项目包名、feesNo、ApplyNo进行分组，返回的是申请单明细
 */
export function listApplyAndDetail(query) {
    return request({
        url: "/business/outpFeesMaster/listApplyAndDetail",
        method: "get",
        params: query,
    });
}

// 获取结账页面综合信息（用于结账查询）
export function getUserCostAndTotal(query) {
    return request({
        url: "/business/outpFeesMaster/getUserCostAndTotal",
        method: "get",
        params: query,
    });
}
